﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Chinesys.DataModel;
using Chinesys.Entities;

namespace Chinesys.Domain.DataMapper
{
    public static class SubCategoryDataMapper
    {
        public static SubCategoryEntity SubCategoryFromRowToEntity(SubCategory row)
        {
            SubCategoryEntity entity;

            if (row == null)
            {
                entity = null;
            }
            else
            {
                entity = new SubCategoryEntity();
                entity.CurrentState = RowState.Original;
                entity.Id = row.Id;
                entity.Name = row.Name;
            }

            return entity;
        }

        public static SubCategory SubCategoryFromEntityToRow(SubCategoryEntity entity)
        {
            SubCategory row;

            if (entity == null)
            {
                row = null;
            }
            else
            {
                row = new SubCategory();
                row.Id = entity.Id;
                row.Name = entity.Name;
            }
            return row;
        }
    }
}
